package cloneExample;

import java.io.Serializable;

public class People implements Cloneable, Serializable {
	private Integer id;
	private String name;
	private Address address;

	/**
	 * 重写父类的克隆方法
	 *
	 * @return
	 * @throws CloneNotSupportedException
	 */
	@Override
	protected Object clone() throws CloneNotSupportedException {
		People people = (People) super.clone();
		people.setAddress(this.address.clone());
		return people;
	}

	public People() {
	}

	public People(Integer id, String name, Address address) {
		this.id = id;
		this.name = name;
		this.address = address;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}
}
